package com.senney.practice.mutilThread.demo01;

import java.util.concurrent.TimeUnit;


public class ThreadDemo {
	public static void main(String[] args) {
		new Thread(ThreadDemo::enjoyMusic).start();
		browseNews();
	}

	private static void browseNews() {
		while (true) {
			System.out.println("Uh-huh, the good news. ");
			sleep(1);
		}
	}

	private static void enjoyMusic() {
		while (true) {
			System.out.println("Uh-huh, the nice music. ");
			sleep(1);
		}
	}

	private static void sleep(int seconds) {
		try {
			TimeUnit.SECONDS.sleep(seconds);
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
	}
	
}
